[ToC] [Up] [Back] [Next] ... [Book Plug] The Information Commons
.................... Introduction to HTML

9.4 Fill-out FORMS and Gateway Programs

FORMs were discussed in Section 4.13. To remind you, a typical, if somewhat idiotic form, looks like:

<FORM ACTION="http://bla.bla.edu/cgi-bin/some-prgm" METHOD=POST>
First entry field: <INPUT NAME="entry1"> <BR>
Second entry field: <INPUT NAME="entry2" VALUE="bloop"> <BR>
Third entry field: <INPUT NAME="entry3">  --- 
Select Option: <SELECT NAME="entry4">
<OPTION VALUE="no1">Frogs
<OPTION VALUE="no2">Peaches
<OPTION VALUE="no3">Cream
<OPTION VALUE="no4">Newts
</SELECT>

To submit the query, press: <INPUT TYPE="submit" VALUE="Submit Query">. <P> </FORM>

(note that you can use TABLEs to format the layout of the form). The above FORM is rendered as follows:
First text entry field:
Second entry field:
Third entry field: --- Select Option:
To submit the query, press: .

9.2.1 Encoding of FORM Data

Now, how are these data sent to the server. In general each form input element is assigned a variable name, such as entry1 through entry4 in the above example. The user input is known as the value assocaited with the names. When the data are sent to a server, they are encoded as strings of the form:
  name1=value1&name2=value2 ....
where name1 .. are the names, and value1... are the values selected by the user. The = and & characters have special meanings in this encoding scheme, and indicate the separators between variabbles. This means that if there are any real = and & in the strings, these must be encoded to "hide" them. They are encoded via the URL encoding, namely as %xx, where xx is the hexadecimal code corresponding to the character.

This encoding, with MIME type application/x-www-form-urlencoded gets rather messy in detail, and is discussed in the online FORM docmentation at NCSA. It is also extensively discussed in my book (among others).


[ToC] [Up] [Back] [Next] ... [Book Plug] .................... Introduction to HTML

© Ian Graham 1994-1996 Page Last Updated: 2 January 1996